<!-- 任务执行情况 -->
<template>
  <el-dialog :title="titleUser" :visible.sync="dialogTableVisible" @close="$emit('update:visible',false)"
             :close-on-click-modal="false">
    <el-table :data="userList"
              :stripe="tableStyle.tableStripe"
              :border="tableStyle.tableBorder"
              tooltip-effect="dark"
              ref="table">
      <el-table-column label="区角名称" align="center">
        <template slot-scope="scope">
          {{scope.row.corner.name}}
        </template>
      </el-table-column>
      <el-table-column label="区角位置" align="center">
        <template slot-scope="scope">
          {{scope.row.classes.class_name}}
        </template>
      </el-table-column>
    </el-table>
    <div slot="footer" class="dialog-footer">
      <el-button @click="$emit('update:visible',false)" size="small">取 消</el-button>
      <el-button type="primary" @click="userlistGet('yse')" size="small">确 定</el-button>
    </div>
  </el-dialog>
</template>
<script>
  import {pagination, tableoption} from '@/utils/util.js'

  export default {
    name: 'taskListDialog',
    props: ['visible', 'dishOption'],
    watch: {
      visible () {
        this.dialogTableVisible = this.visible
        if (this.visible) {
          console.log('dishOption:', this.dishOption)
          this.titleUser = this.dishOption.student_name + ' 今日的预约'
          this.InitFn()
        }
      }
    },
    data () {
      return {
        // 设置table样式
        tableStyle: tableoption,
        // 设置table页面分页所需
        page: {
          pageindex: pagination.pageIndex,
          pagesize: pagination.pageSize,
          total: pagination.total
        },
        dialogTableVisible: this.visible,
        titleUser: '',
        userList: []
      }
    },
    created () {
    },
    methods: {
      InitFn () {
        this.$fetch(this.api.admin_corner_apply_apply_user, {student_id: this.dishOption.student_id}).then((response) => {
          if (response.code === 0) {
            this.userList = response.list
          } else {
          }
        }).catch((err) => {
          console.log(err)
        })
      },
      // 用户人员分页
      handleSizeChange (val) {
        this.page.pageindex = val
        this.InitFn()
      }
    }
  }
</script>
